
public class Equilator {
	Generator cardgen;
	Scoring scorer;
	Scores scores;
	Holding h1;
	Holding h2;
	Card[] board;
	
	public Equilator(){
		cardgen = new Generator();
		scorer = new Scoring();
		scores = new Scores();

	}
	
	private String interpretCard(Card c){
		String ret="";
		//erst die kartenhöhe..
		if(c.getCard()[0]<8)
			ret += (c.getCard()[0]+2);
		else switch(c.getCard()[0]){
			case 8:
				ret += "T";
				break;
			case 9:
				ret += "J";
				break;
			case 10:
				ret += "Q";
				break;
			case 11:
				ret += "K";
				break;
			case 12:
				ret += "A";
				break;
			}
		
			//dann die farbe..
			switch(c.getCard()[1]){
				case 0:
					ret += "s";
					break;
				case 1:
					ret += "c";
					break;
				case 2:
					ret += "d";
					break;
				case 3:
					ret += "h";
					break;
			}
			return ret;
	}
	
	public void equi(Holding h1, Holding h2){
	
		this.cardgen.holdingtaken(h1);
		this.cardgen.holdingtaken(h2);
	/*
	Card[] hand = new Card[2];
	hand[0] = new Card(7,0);
	hand[1] = new Card(7,1);
	
	Card[] bo = new Card[5];
	bo[0] = new Card(8,2);
	bo[1] = new Card(8,3);
	bo[2] = new Card(0,0);
	bo[3] = new Card(0,1);
	bo[4] = new Card(0,2);
	
	char[] sc = scorer.scorethese(hand, bo);
	System.out.println(sc);
	*/
	int trials = 10000;
	int winner[] = new int[3];
	for(int i=0;i<3;i++)
		winner[i] = 0;
	/*Holding h1, h2;	
	h1 = cardgen.make_holding();
	h2 = cardgen.make_holding();*/

	
	for(int j=0;j<trials;j++){
		board = cardgen.make_board();
		String score1 = new String(scorer.scorethese(h1.getHolding(),board));
		String score2 = new String(scorer.scorethese(h2.getHolding(),board));
	
		
		//System.out.println("Holding 1: "+interpretCard(h1.getHolding()[0])+" "+interpretCard(h1.getHolding()[1]));
		//System.out.println(score1);
	
		//System.out.println("Holding 2: "+interpretCard(h2.getHolding()[0])+" "+interpretCard(h2.getHolding()[1]));
		//System.out.println(score2);
	
		
		//System.out.print("Board: ");
		//for(int i=0;i<5;i++)
			//System.out.print(interpretCard(board[i])+" ");
		//System.out.println("");
		
		
		scores.setscore(score1,score2);
	
		
		switch(scores.sieger()){
			case 0:
				//System.out.println("Unentschieden");
				winner[0]++;
				break;
			case 1:
				//System.out.println("Erster Spieler gewinnt");
				winner[1]++;
				break;
			case 2:
				//System.out.println("Zweiter Spieler gewinnt");
				winner[2]++;
				break;
		}
		this.cardgen.resetcards();
	}
	System.out.println("Holding 1: "+interpretCard(h1.getHolding()[0])+" "+interpretCard(h1.getHolding()[1]));
	System.out.println("Holding 2: "+interpretCard(h2.getHolding()[0])+" "+interpretCard(h2.getHolding()[1]));
	System.out.println(winner[1]+" "+winner[0]+" "+winner[2]);
	}
}
